home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 424_02 / ED-157 / openline.c < prev    next >
C/C++ Source or Header  |  1993-09-10  |  2KB  |  56 lines

  1. /*
  2.  * Copyright (C) 1992 by Rush Record (rhr@clio.rice.edu)
  3.  * 
  4.  * This file is part of ED.
  5.  * 
  6.  * ED is free software; you can redistribute it and/or modify it under the terms
  7.  * of the GNU General Public License as published by the Free Software Foundation.
  8.  * 
  9.  * ED is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  10.  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  11.  * PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  12.  * 
  13.  * You should have received a copy of the GNU General Public License along with ED
  14.  * (see the file COPYING).  If not, write to the Free Software Foundation, 675
  15.  * Mass Ave, Cambridge, MA 02139, USA.
  16.  */
  17. #include "opsys.h"
  18.  
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21.  
  22. #include "rec.h"
  23. #include "window.h"
  24. #include "ed_dec.h"
  25. #include "buffer.h"
  26.  
  27. /******************************************************************************\
  28. |Routine: openline
  29. |Callby: edit
  30. |Purpose: Inserts new, empty records in the current file.
  31. |Arguments:
  32. |    repeat is the count of records to insert.
  33. \******************************************************************************/
  34. void openline(repeat)
  35. register Int repeat;
  36. {
  37.     buf_node cr;
  38.     rec_ptr r;
  39.     register Int i;
  40.  
  41.     cr.nrecs = repeat + 1;
  42.     cr.direction = -1;
  43.     cr.first = (rec_ptr)&cr.first;
  44.     cr.last = (rec_ptr)&cr.first;
  45.     for(i = 0;i <= repeat;i++)
  46.     {
  47.         r = (rec_ptr)imalloc(sizeof(rec_node));
  48.         r->length = 0;
  49.         r->data = NULL;
  50.         insq(r,cr.last);
  51.     }
  52.     insert(&cr);
  53.     buffer_empty(&cr);
  54. }
  55.  
  56.